import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public Client() {
        try {
            Socket socket = new Socket("127.0.0.1",8099);

            InputStream is = socket.getInputStream();
            OutputStream os = socket.getOutputStream();

            os.write("hello".getBytes());
            os.flush();

            byte[] by = new byte[1024];
            is.read(by);
            String str = new String(by);
            System.out.println("服务器发送："+str.trim());

            os.close();
            is.close();
            socket.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new Client();
    }
}
